package 剑指offer.面试题62;

public class Solution {
    public int lastRemaining(int n, int m) {
        int ans = 0;
        for(int i = 2;i<=n;i++){
            ans = (ans+m)%i;
        }
        return ans;
    }
}
